import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * This class is Return check assignment UI
 */
public class SecUI  extends JPanel {
	/**
	 * title for the current window  
	 */
	private JLabel lbltitle = null;
	/**
	 * open semester
	 */
	private JButton btnOpenSem = null;
	/**
	 * add class
	 */
	private JButton btnAddClass = null;
	/**
	 * add new class
	 */
	private JButton btnNewClass = null;
	/**
	 * back button
	 */
	public JButton btnBack = null;
	/**
	 * help button
	 */
	public JButton btnHelp = null;
	
	private JPanel curPanel;

	
	
	public SecUI () {
		super();
		initialize();
	}

	private void initialize() {
		curPanel = this;
		btnOpenSem = new JButton();
		btnOpenSem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				SemUI semUI = new SemUI();
				setVisible(false);
				System.out.println("Open new sem");
				Global.main.setContentPane(semUI);
				semUI.btnBack.addActionListener(new ActionListener() {   //back from open sem UI
					public void actionPerformed(ActionEvent arg0) {
						Global.main.setContentPane(curPanel);
						curPanel.setVisible(true);
					}
				});
			}
		});
		
		btnOpenSem.setBounds(new Rectangle(130, 73, 220, 25));
		btnOpenSem.setText("Open new semester");
		this.add(btnOpenSem,null);
		this.setVisible(true);
		
		curPanel = this;
		btnAddClass = new JButton();
		btnAddClass.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				AddClassToCourseUI addClassToCourseUI = new AddClassToCourseUI();
				setVisible(false);
				System.out.println("Add course to current semeste");
				Global.main.setContentPane(addClassToCourseUI);
				addClassToCourseUI.btnBack.addActionListener(new ActionListener() {   //back from open sem UI
					public void actionPerformed(ActionEvent arg0) {
						Global.main.setContentPane(curPanel);
						curPanel.setVisible(true);
					}
				});
			}
		});
		btnAddClass.setBounds(new Rectangle(130, 140, 220, 25));
		btnAddClass.setText("Add course to current semeste");
		this.add(btnAddClass,null);
		this.setVisible(true);
		
		
		
		btnNewClass = new JButton();
		btnNewClass.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				ClassUI classUI = new ClassUI();
				setVisible(false);
				System.out.println("Define new class");
				Global.main.setContentPane(classUI);
				classUI.btnBack.addActionListener(new ActionListener() {   //back from admin UI
					public void actionPerformed(ActionEvent arg0) {
						Global.main.setContentPane(curPanel);
						curPanel.setVisible(true);
					}
				});
			}
		});
		btnNewClass.setBounds(new Rectangle(130, 198, 220, 25));
		btnNewClass.setText("Add New Class");
		this.add(btnNewClass,null);
		this.setVisible(true);

		lbltitle = new JLabel("Secretery task");
		lbltitle.setBounds(193, 28, 110, 14);

		this.setSize(400, 321);
		this.setLayout(null);
		
		this.add(lbltitle);
	
		btnBack = new JButton("Back");
		btnBack.setBounds(187, 253, 86, 25);
		this.add(btnBack,null);
		this.setVisible(true);
		
		btnHelp = new JButton("Help");
		btnHelp.setBounds(390, 11, 80, 19);
		btnHelp.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				  HelpWin err = new HelpWin ("Click on one of the option");
				  System.out.println("user press Help button");
			}
		});
		this.add(btnHelp,null);
		this.setVisible(true);
		
	}
			
			
}